﻿$(function () {

    $('#container_spider').highcharts({                     // 蜘蛛图的初始化状态
        chart: {
            polar: true,
            type: 'line'
        },
        title: {
            text: '机床系统健康状态',
            x: 20
        },
        pane: {
            size: '80%'
        },
        xAxis: {
            categories: ['X轴', '主轴', '刀库', 'Z轴',
                         'Y轴'],
            tickmarkPlacement: 'on',
            lineWidth: 0
        },
        yAxis: {
            gridLineInterpolation: 'polygon',
            lineWidth: 0,
            min: 0
        },
        tooltip: {
            shared: true,
            pointFormat: '<span style="color:{series.color}">{series.name}: <b>${point.y:,.0f}</b><br/>'
        },
        legend: {
            align: 'right',
            verticalAlign: 'top',
            y: 70,
            layout: 'vertical'
        },
        series: [{
            name: '机床健康指数',
            data: [43000, 19000, 60000, 35000, 17000],
            pointPlacement: 'on'
        }, {
            name: '实际健康指数',
            data: [50000, 39000, 42000, 31000, 26000],
            pointPlacement: 'on'
        }],
        credits: {
            enabled: false
        }
    });

    $('#container_rectangle').highcharts({                      // 矩形图的初始化状态
        chart: {
            type: 'bar'
        },
        title: {
            text: '机床健康指数'
        },
        xAxis: {
            categories: ['主轴', 'X轴', 'Y轴', 'Z轴', '刀库'],
            title: {
                text: null
            }
        },
        yAxis: {
            min: 0,
            title: {
                text: '时间t',
                align: 'high'
            },
            labels: {
                overflow: 'justify'
            }
        },
        tooltip: {
            valueSuffix: ' 千万'
        },
        plotOptions: {
            bar: {
                dataLabels: {
                    enabled: true,
                    allowOverlap: true
                }
            }
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'top',
            x: -40,
            y: 50,
            floating: true,
            borderWidth: 1,
            backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
            shadow: true
        },
        credits: {
            enabled: false
        },
        series: [{
            name: '标准健康指数',
            data: [107, 31, 635, 203, 2]
        }, {
            name: '实际健康指数',
            data: [133, 156, 947, 408, 6]
        }]
    });
});


function ChangeDivShow(num) {
    if (num == 1) {
        document.getElementById("health").style.display = "block";
        document.getElementById("equipment").style.display = "none";
    }
    else {
        document.getElementById("equipment").style.display = "block";
        document.getElementById("health").style.display = "none";
    }
}
var flag = true;
function chkRadio(id){
    id.checked = flag;
    flag = !flag;
}
